﻿#ifndef __GAF_COMMANDFACE_H__
#define __GAF_COMMANDFACE_H__

namespace GAF
{
	//class Graphics -* _INTERFACE ForEach
		//class Face
			class CommandFace;
}
typedef	GAF::CommandFace		GAF_CCommandFace;

#include "GAF_Define.h"
#include "GAF_DeviceCode.h"
#include "GAF_Face.h"

namespace GAF
{
	/// 控件类
	class _ABSTRACT CommandFace : public Face
	{
	protected:
		static CommandFace**	ms_ppFocus;

	public:
		CommandFace();
		virtual ~CommandFace();


		// 重载方法
	public:
		/// 添加绘制对象
		void			AddGraphics(Graphics* pGraphics);

		// 继承事件
// 	public:
// 		virtual bool		OnPreRender(Graphics* pGraphics);		// 渲染之前
// 		virtual bool		OnRender()					// 渲染时
// 	protected:
// 		// 当初始化时
// 		virtual bool		OnInit(Bundle* pParam)				// 界面初始化时

	public:
		/// 按键按下
		void			KeyDown(ULONG lCode);
		/// 按键抬起
		void			KeyUp(ULONG lCode);
		/// 指针按下
		void			CursorDown(ULONG lCode, ULONG lAt);
		/// 指针抬起
		void			CursorUp(ULONG lCode, ULONG lAt);
		/// 指针移动
		void			CursorMove(ULONG lAt);

		/**
		 *  @name 事件成员
		 */
		// 事件成员
	protected:
		/// 按键按下时
		_CMDFUN virtual void	OnKeyDown(ULONG lCode)
					{return;}
		/// 按键抬起时
		_CMDFUN virtual void	OnKeyUp(ULONG lCode)
					{return;}
		/// 指针按下时
		_CMDFUN virtual void	OnCursorDown(ULONG lCode, int nX, int nY)
					{return;}
		/// 指针抬起时
		_CMDFUN virtual void	OnCursorUp(ULONG lCode, int nX, int nY)
					{return;}
		/// 指针移动时
		_CMDFUN virtual void	OnCursorMove(int nX, int nY, int nXChange, int nYChange)
					{return;}
		/// 屏幕滑动时
		_CMDFUN virtual void	OnSceenSlide(double dWay, int nLong)
					{return;}
		/// 屏幕甩动时
		_CMDFUN virtual void	OnSceenSwing(double dWay, double dPower)
					{return;}

	private:
		int			WayAngle(int nBX, int nBY, int nEX, int nEY);

	private:
		Link<CommandFace*>	m_lnkCommandFace;
	};
}

#endif
